/*
 * File: FltLevelSettingFT.c
 *
 * Code generated for Simulink model 'FLTM'.
 *
 * Model version                  : 3.719
 * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
 * C/C++ source code generated on : Fri Dec 29 09:53:44 2023
 */

#include "FltLevelSettingFT.h"

/* Named constants for Chart: '<S55>/FetLevelSetFT' */
#define IN_Err_LV                      ((uint8_T)1U)
#define IN_Err_Nor_a                   ((uint8_T)2U)
#define IN_FltJudge                    ((uint8_T)1U)
#define IN_Init_c                      ((uint8_T)2U)
#define IN_NO_ACTIVE_CHILD             ((uint8_T)0U)

/*
 * Output and update for atomic system:
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    'FetLevelSetFT' ('mylib:258')
 *    ...
 */
void FltLevelSettingFT(boolean_T LVCfm, boolean_T LVCel, B_FltLevelSettingFT_T
                       *localB, DW_FltLevelSettingFT_T *localDW, uint8_T
                       rtp_FltLevel, uint8_T rtp_Flttye, boolean_T
                       *rtd_ClearFault)
{
    if (localDW->is_active_c5_mylib == 0U)
    {
        localDW->is_active_c5_mylib = 1U;
        localDW->is_c5_mylib = IN_Init_c;
        localB->ScFlt_LV = 0U;
    }
    else if (localDW->is_c5_mylib == IN_FltJudge)
    {
        if (*rtd_ClearFault)
        {
            localDW->is_FltJudge = IN_NO_ACTIVE_CHILD;
            localDW->is_c5_mylib = IN_Init_c;
            localB->ScFlt_LV = 0U;
        }
        else if (localDW->is_FltJudge == IN_Err_LV)
        {
            localB->ScFlt_LV = rtp_FltLevel;
            if (LVCel)
            {
                localDW->is_FltJudge = IN_Err_Nor_a;
                localB->ScFlt_LV = 0U;
            }
        }
        else
        {
            /* case IN_Err_Nor: */
            localB->ScFlt_LV = 0U;
            if (LVCfm)
            {
                localDW->is_FltJudge = IN_Err_LV;
                localB->ScFlt_LV = rtp_FltLevel;
            }
        }
    }
    else
    {
        /* case IN_Init: */
        localB->ScFlt_LV = 0U;
        if ((rtp_Flttye == 1) && (!*rtd_ClearFault))
        {
            localDW->is_c5_mylib = IN_FltJudge;
            localDW->is_FltJudge = IN_Err_Nor_a;
            localB->ScFlt_LV = 0U;
        }
    }
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
